﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using VISS.API.Users;
using NCT.Framework;

namespace VISS.Web.Frontend.Modules.User.Profile {
    public partial class ActionBoxControl : System.Web.UI.UserControl {

        public bool IsPersonal;
        public string UserKey;
        public string FullName;
        public int ImageCount;
        public int totalDays;
        public bool CanDoAction;
        public DateTime LastLogin { get; set; }
        protected string UserName = string.Empty;
        protected void Page_Load(object sender, EventArgs e) {
            
            if (!IsPostBack)
            {  
                UserEnt userEnt = new UserEnt();

                userEnt = StructureMapFactory.GetInstance<IUser>().GetByUserKey(UserKey);

                if (userEnt == null)
                {
                    Response.Redirect("/error?t=" + (int)EErrorType.ProfileNotFound);
                    return;  
                }
                else
                {
                    LastLogin = userEnt.LastLogin;
                    totalDays = DateTime.Now.Subtract(LastLogin).Days;
                }
            }

        }
    }
}